<div class="form-group clearfix">
  <div class="pull-left form-inline">
    <button type="button" class="btn btn-success" (click)="showAddModal()">添加</button>
  </div>
</div>
<div style="margin-bottom: 16px;">
  <!--<button nz-button [disabled]="_disabledButton" [nzType]="'primary'" [nzLoading]="_operating" (click)="_operateData()">开启</button>-->
  <nz-dropdown-button [nzDisable]="_disabledButton">
    <div (click)="optionsOpen()">开启</div>
    <ul nz-menu>
      <li nz-menu-item>
        <div  (click)="optionsOpen()">开启</div>
      </li>
      <li nz-menu-item>
        <div  (click)="optionsClose()">关闭</div>
      </li>
    </ul>
  </nz-dropdown-button>
  <span style="margin-left: 8px;" *ngIf="_checkedNumber">已选择 {{_checkedNumber}} 项</span>
</div>

<div>
  <nz-spin [nzTip]="'正在读取列表...'" [nzSpinning]="_isSpinning" [nzSize]="'large'" class="admin-spin">
    <table class="table" #nzTable (nzDataChange)="_displayDataChange($event)" (nzPageIndexChange)="_refreshStatus()"
           (nzPageSizeChange)="_refreshStatus()">
      <thead>
      <tr>
        <th nz-th [nzCheckbox]="true">
          <label nz-checkbox [(ngModel)]="_allChecked" [nzIndeterminate]="_indeterminate"
                 (ngModelChange)="_checkAll($event)">
          </label>
        </th>
        <th>ID</th>
        <th>名称</th>
        <th>状态</th>
        <th>描述</th>
        <th>操作</th>
      </tr>
      </thead>
      <tbody>
      <tr *ngFor="let item of activityList;index as i">
        <td nz-td [nzCheckbox]="true">
          <label nz-checkbox [(ngModel)]="item.checked" (ngModelChange)="_refreshStatus($event)">
          </label>
        </td>
        <td>{{item.id}}</td>
        <td style="width:200px;word-break:break-all;">{{item.activity_name}}</td>
        <td *ngIf="item.type == 1">开启</td>
        <td *ngIf="item.type == 0">关闭</td>
        <td style="width:200px;word-break:break-all;">{{item.activity_name}}</td>
        <td>
          <nz-switch [ngModel]="item.type==1" (click)="onStatus(i)">
            <span checked>开</span>
            <span unchecked>关</span>
          </nz-switch>
        </td>
      </tr>
      </tbody>
    </table>
  </nz-spin>
  <div class="text-center">
    <pagination (pageChanged)="pageChanged($event)" [totalItems]="totalItems" [itemsPerPage]="itemsPerPage"
                [(ngModel)]="currentPage"
                [maxSize]="10"
                previousText="&lsaquo;" nextText="&rsaquo;" firstText="&laquo;" lastText="&raquo;"
                [boundaryLinks]="true" class="pagination-sm"></pagination>
  </div>
</div>

<app-notification [type]="type" [message]="message" [isShow]="isShow"
                  (promptIsShow)="promptIsShow($event)"></app-notification>


<div class="modal fade" bsModal #confirmModal="bs-modal" tabindex="-1">
  <div class="modal-dialog modal-xs">
    <div class="modal-content">
      <div class="modal-header">
        <h4 class="modal-title pull-left">温馨提示</h4>
        <button type="button" class="close pull-right" aria-label="Close" (click)="closeConfirmModal()">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <div class="form-group clearfix">
          <p>您确定要{{ confirmTitle }}吗？</p>
        </div>
        <form>
          <div class="text-center mt20">
            <button class="btn btn-default btn-md-long" type="button" (click)="closeConfirmModal();">取消</button>
            <button class="btn btn-success btn-md-long" type="submit"
                    (click)=" confirmStatus != 3 ? changeStatus() : delete();">确定
            </button>
          </div>
        </form>
      </div>
    </div>
  </div>
</div>


<div class="modal fade" bsModal #addModal="bs-modal" tabindex="-1">
  <div class="modal-dialog modal-xs">
    <form #addForm="ngForm">
      <div class="modal-content">
        <div class="modal-header">
          <h4 class="modal-title pull-left">添加</h4>
          <button type="button" class="close pull-right" aria-label="Close"
                  (click)="cancel()">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>
        <div class="modal-body">
          <div class="form-group clearfix">
            <label class="col-md-2">名称:</label>
            <div class="col-md-8">
              <input type="text" class="form-control" name="nickName" required>
            </div>
          </div>
          <div class="form-group clearfix">
            <label class="col-md-2">小店名称:</label>
            <div class="col-md-8">
              <input type="text" class="form-control" name="member_store_name" required>
            </div>
          </div>

          <div class="text-center mt20">
            <button class="btn btn-default btn-md-long" type="button"
                    (click)="cancel()">取 消
            </button>
            <button class="btn btn-success btn-md-long" type="button"
                    (click)="addRobot1();">添 加
            </button>
          </div>
        </div>
      </div>
    </form>
  </div>
</div>

